<?PHP
header("Content-Type: text/html; charset=utf-8");
include_once 'public/DB_Oracle.php';
$DBsql = new DB_Oracle ();
if(isset($_POST['str'])){
$sql="select * from dep_time";
$arr=$DBsql->fetch_all_array($sql);
if(count($arr)==0){
$sql="insert into dep_time(time)values('".$_POST['str']."')";
$DBsql->query($sql);
exit('y');
    }else{
        $sql="update dep_time dp 
          set dp.time='".$_POST['str']."'";
          $DBsql->query($sql);
          exit('y');
	}
exit();
}
if(isset($_GET['option'])&&$_GET['option']=="add"){
$sql="update loc_number t set t.number_id='".$_GET['num']."'";
if($DBsql->query($sql)){
	echo "<script language='javascript'>alert('修改成功');window.location.href='listen1.php';</script>";
	}else{
	echo "<script language='javascript'>alert('修改失败');window.location.href='listen1.php';</script>";}
	}
?>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/validform.css" rel="stylesheet" type="text/css" />
<link href="public/page/css/css.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="js/public.js"></script>
<script language="javascript">
	function ADD(){
		           if(document.getElementById("add").value==""){
			   alert("请检查你输入是否正确");
			   return false;
			   }
			   var li=/^\d{6,15}$/;
		   if(!li.test(document.getElementById("add").value)){
			   alert("请检查你输入是否正确");
			   return false;
			   }
	var url="listen1.php?"+encodeURI("option=add&num="+document.getElementById("add").value);
	window.location=url;  
		}
	
var af;
function abc(){
	if(document.getElementById('abc').value==''){
		alert("输入信息不能为空");
		return 0;
		}
		var li=/^\d+$/;
		var str=document.getElementById('abc').value;
		if(!li.test(str)||parseInt(str)>=1800||parseInt(str)==0){
			alert("输入值错误!");
			return 0;
			}
	$.ajax({
			type:"POST",
			url:"dep_time.php",
			cache:false,
			data:"str="+str,
			success:function(data){
				if(data=="y"){
					
					alert("设置成功");
					}else{
						alert("超过最大值");
						}
					}
		});
	}
</script>
<!--管理列表开始-->
<div class="manageTab" style="margin-top:0px;">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="usrTab">
    <tr>
      <td width="8" height="25"><img src="images/user_01.jpg" height="25" width="8" /></td>
      <td style="background:#3980b2;" valign="middle" height="16" ><div class="use_righgDiv"></div>
        <div class="use_leftDiv">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td  width="22"><img src="images/311.gif" height="16" width="16" /></td>
              <td align="left"><span class="tdTit">设置在线时间</span></td>
            </tr>
          </table>
        </div></td>
      <td width="8" height="25"><img src="images/user_02.gif" height="25" width="8" /></td>
    </tr>
    <tr>
      <td style="background:#3980b2;" >&nbsp;</td>
      <td><table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="usrList" id="List">
          <tr>
          	 
            <td  class="td90b2">输入时间</td>
            <td  class="td90b2">查询</td>
            <td  class="td90b2">功能介绍</td>
          </tr>
	          <tr>
	            <td class="tdfff"><textarea  style="width:300px"  id="abc"></textarea>单位：秒（不能超过1800秒）</td>
                <td class="tdfff"><input type="button" id="f" onclick="abc()" value="提交" /></td>
                <td class="tdfff">在设定的时限内终端与服务器有通信即判定终端在线
，默认是30秒。</td>
	          </tr>
          <tr>
            <td colspan="10" class="tdfff">&nbsp;</td>
          </tr>
        </table></td>
      <td style="background:#3980b2;">&nbsp;</td>
    </tr>
    <tr>
      <td height="24" width="8"><img src="images/user_03.gif" height="24" width="8" /></td>
      <td style="background:#3980b2;">
    </td>
      <td height="24" width="8"><img src="images/user_04.gif" height="24" width="8" /></td>
    </tr>
  </table>
</div>
<!--管理列表结束-->
